from django.contrib.auth.mixins import LoginRequiredMixin
from django import http

class LoginRequiredJsonMixin(LoginRequiredMixin):
    """Verify that the current user is authenticated.
    handle_no_permission说明：我们只需要改写父类中的处理方式
    至于如何判断用户是否登录
    在父类中已经判断了
    """
    def handle_no_permission(self):

        return http.JsonResponse({'code': 400, 'errmsg': '用户未登录'})